#include <stdio.h>
#include <string.h>
#include "gui2/windows/gui_input.h"

static char tmpkeyname[8];

char *keyname(u32 key)
{
	char *ret;

	switch(key) {
		case SDLK_BACKSPACE: ret = "BKS"; break;
		case SDLK_TAB: ret = "TAB"; break;
		case SDLK_CLEAR: ret = "CLR"; break;
		case SDLK_RETURN: ret = "RET"; break;
		case SDLK_PAUSE: ret = "PSE"; break;
		case SDLK_ESCAPE: ret = "ESC"; break;
		case SDLK_SPACE: ret = "SPC"; break;
		case SDLK_EXCLAIM: ret = "!"; break;
		case SDLK_QUOTEDBL: ret = "\""; break;
		case SDLK_HASH: ret = "#"; break;
		case SDLK_DOLLAR: ret = "$"; break;
		case SDLK_AMPERSAND: ret = "&"; break;
		case SDLK_QUOTE: ret = "'"; break;
		case SDLK_LEFTPAREN: ret = "("; break;
		case SDLK_RIGHTPAREN: ret = ")"; break;
		case SDLK_ASTERISK: ret = "*"; break;
		case SDLK_PLUS: ret = "+"; break;
		case SDLK_COMMA: ret = ","; break;
		case SDLK_MINUS: ret = "-"; break;
		case SDLK_PERIOD: ret = "."; break;
		case SDLK_SLASH: ret = "/"; break;
		case SDLK_0: ret = "0"; break;
		case SDLK_1: ret = "1"; break;
		case SDLK_2: ret = "2"; break;
		case SDLK_3: ret = "3"; break;
		case SDLK_4: ret = "4"; break;
		case SDLK_5: ret = "5"; break;
		case SDLK_6: ret = "6"; break;
		case SDLK_7: ret = "7"; break;
		case SDLK_8: ret = "8"; break;
		case SDLK_9: ret = "9"; break;
		case SDLK_COLON: ret = ":"; break;
		case SDLK_SEMICOLON: ret = ";"; break;
		case SDLK_LESS: ret = "<"; break;
		case SDLK_EQUALS: ret = "="; break;
		case SDLK_GREATER: ret = ">"; break;
		case SDLK_QUESTION: ret = "?"; break;
		case SDLK_AT: ret = "@"; break;
		case SDLK_LEFTBRACKET: ret = "["; break;
		case SDLK_BACKSLASH: ret = "\\"; break;
		case SDLK_RIGHTBRACKET: ret = "]"; break;
		case SDLK_CARET: ret = "^"; break;
		case SDLK_UNDERSCORE: ret = "_"; break;
		case SDLK_BACKQUOTE: ret = "`"; break;
		case SDLK_a: ret = "A"; break;
		case SDLK_b: ret = "B"; break;
		case SDLK_c: ret = "C"; break;
		case SDLK_d: ret = "D"; break;
		case SDLK_e: ret = "E"; break;
		case SDLK_f: ret = "F"; break;
		case SDLK_g: ret = "G"; break;
		case SDLK_h: ret = "H"; break;
		case SDLK_i: ret = "I"; break;
		case SDLK_j: ret = "J"; break;
		case SDLK_k: ret = "K"; break;
		case SDLK_l: ret = "L"; break;
		case SDLK_m: ret = "M"; break;
		case SDLK_n: ret = "N"; break;
		case SDLK_o: ret = "O"; break;
		case SDLK_p: ret = "P"; break;
		case SDLK_q: ret = "Q"; break;
		case SDLK_r: ret = "R"; break;
		case SDLK_s: ret = "S"; break;
		case SDLK_t: ret = "T"; break;
		case SDLK_u: ret = "U"; break;
		case SDLK_v: ret = "V"; break;
		case SDLK_w: ret = "W"; break;
		case SDLK_x: ret = "X"; break;
		case SDLK_y: ret = "Y"; break;
		case SDLK_z: ret = "Z"; break;
		case SDLK_DELETE: ret = "DEL"; break;
		case SDLK_KP0: ret = "N0"; break;
		case SDLK_KP1: ret = "N1"; break;
		case SDLK_KP2: ret = "N2"; break;
		case SDLK_KP3: ret = "N3"; break;
		case SDLK_KP4: ret = "N4"; break;
		case SDLK_KP5: ret = "N5"; break;
		case SDLK_KP6: ret = "N6"; break;
		case SDLK_KP7: ret = "N7"; break;
		case SDLK_KP8: ret = "N8"; break;
		case SDLK_KP9: ret = "N9"; break;
		case SDLK_KP_PERIOD: ret = "N."; break;
		case SDLK_KP_DIVIDE: ret = "N/"; break;
		case SDLK_KP_MULTIPLY: ret = "N*"; break;
		case SDLK_KP_MINUS: ret = "N-"; break;
		case SDLK_KP_PLUS: ret = "N+"; break;
		case SDLK_KP_ENTER: ret = "NEN"; break;
		case SDLK_KP_EQUALS: ret = "N="; break;
		case SDLK_UP: ret = "UP"; break;
		case SDLK_DOWN: ret = "DWN"; break;
		case SDLK_RIGHT: ret = "RGT"; break;
		case SDLK_LEFT: ret = "LFT"; break;
		case SDLK_INSERT: ret = "INS"; break;
		case SDLK_HOME: ret = "HOM"; break;
		case SDLK_END: ret = "END"; break;
		case SDLK_PAGEUP: ret = "PUP"; break;
		case SDLK_PAGEDOWN: ret = "PDN"; break;
		case SDLK_F1: ret = "F1"; break;
		case SDLK_F2: ret = "F2"; break;
		case SDLK_F3: ret = "F3"; break;
		case SDLK_F4: ret = "F4"; break;
		case SDLK_F5: ret = "F5"; break;
		case SDLK_F6: ret = "F6"; break;
		case SDLK_F7: ret = "F7"; break;
		case SDLK_F8: ret = "F8"; break;
		case SDLK_F9: ret = "F9"; break;
		case SDLK_F10: ret = "F10"; break;
		case SDLK_F11: ret = "F11"; break;
		case SDLK_F12: ret = "F12"; break;
		case SDLK_F13: ret = "F13"; break;
		case SDLK_F14: ret = "F14"; break;
		case SDLK_F15: ret = "F15"; break;
		case SDLK_NUMLOCK: ret = "NLK"; break;
		case SDLK_CAPSLOCK: ret = "CLK"; break;
		case SDLK_SCROLLOCK: ret = "SLK"; break;
		case SDLK_RSHIFT: ret = "RSH"; break;
		case SDLK_LSHIFT: ret = "LSH"; break;
		case SDLK_RCTRL: ret = "RCT"; break;
		case SDLK_LCTRL: ret = "LCT"; break;
		case SDLK_RALT: ret = "RAL"; break;
		case SDLK_LALT: ret = "LAL"; break;
		case SDLK_RMETA: ret = "RMT"; break;
		case SDLK_LMETA: ret = "LMT"; break;
		case SDLK_LSUPER: ret = "LSU"; break;
		case SDLK_RSUPER: ret = "MSU"; break;
		case SDLK_MODE: ret = "MOD"; break;
		case SDLK_HELP: ret = "HLP"; break;
		case SDLK_PRINT: ret = "PRT"; break;
		case SDLK_SYSREQ: ret = "SRQ"; break;
		case SDLK_BREAK: ret = "BRK"; break;
		case SDLK_MENU: ret = "MNU"; break;
		case SDLK_POWER: ret = "PWR"; break;
		case SDLK_EURO: ret = "EUR"; break;
		default:
			sprintf(tmpkeyname,"%d",key);
			ret = tmpkeyname;
			break;
	}
	return(ret);
}
